package com.zrrd.learn.chapter08面向对象.综合类设计题.commodityfactory;

/**
 * 工厂测试类
 *
 * @author wrn
 * @version 1.0
 * @date 2023/8/9 20:48
 */

public class TestProduct {

    public static void main(String[] args) {
        Product p1 = new ConcreteProductA();
        Product p2 = new ConcreteProductB();

        p1.setName("蛋糕");
        p1.setPrice(123);

        p2.setName("桌子");
        p2.setPrice(234);

        p1.show();
        p2.show();

        ProductFactory pro1 = new ConcreteFactoryA();
        ProductFactory pro2 = new ConcreteFactoryB();


        pro1.addGoods();
        pro2.addGoods();
    }

}
